<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QWhatsThis Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QWhatsThis Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QWhatsThis class provides a simple description of any
widget, i.e. answering the question "What's This?". <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qwhatsthis.html#QWhatsThis">__init__</a></b> (<i>self</i>, QWhatsThis)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QAction <b><a href="qwhatsthis.html#createAction">createAction</a></b> (QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qwhatsthis.html#enterWhatsThisMode">enterWhatsThisMode</a></b> ()</li><li><div class="fn" /><b><a href="qwhatsthis.html#hideText">hideText</a></b> ()</li><li><div class="fn" />bool <b><a href="qwhatsthis.html#inWhatsThisMode">inWhatsThisMode</a></b> ()</li><li><div class="fn" /><b><a href="qwhatsthis.html#leaveWhatsThisMode">leaveWhatsThisMode</a></b> ()</li><li><div class="fn" /><b><a href="qwhatsthis.html#showText">showText</a></b> (QPoint&#160;<i>pos</i>, QString&#160;<i>text</i>, QWidget&#160;<i>widget</i>&#160;=&#160;None)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QWhatsThis class provides a simple description of any
widget, i.e. answering the question "What's This?".</p>
<p>"What's This?" help is part of an application's online help
system, and provides users with information about the functionality
and usage of a particular widget. "What's This?" help texts are
typically longer and more detailed than <a href="qtooltip.html">tooltips</a>, but generally provide less
information than that supplied by separate help windows.</p>
<p>QWhatsThis provides a single window with an explanatory text
that pops up when the user asks "What's This?". The default way for
users to ask the question is to move the focus to the relevant
widget and press Shift+F1. The help text appears immediately; it
goes away as soon as the user does something else. (Note that if
there is a shortcut for Shift+F1, this mechanism will not work.)
Some dialogs provide a "?" button that users can click to enter
"What's This?" mode; they then click the relevant widget to pop up
the "What's This?" window. It is also possible to provide a a menu
option or toolbar button to switch into "What's This?" mode.</p>
<p>To add "What's This?" text to a widget or an action, you simply
call <a href="qwidget.html#whatsThis-prop">QWidget.setWhatsThis</a>() or
<a href="qaction.html#whatsThis-prop">QAction.setWhatsThis</a>().</p>
<p>The text can be either rich text or plain text. If you specify a
rich text formatted string, it will be rendered using the default
stylesheet, making it possible to embed images in the displayed
text. To be as fast as possible, the default stylesheet uses a
simple method to determine whether the text can be rendered as
plain text. See <a href="qt.html#mightBeRichText">Qt.mightBeRichText</a>() for
details.</p>
<pre class="cpp">
     newAct <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qaction.html">QAction</a></span>(tr(<span class="string">"&amp;New"</span>)<span class="operator">,</span> <span class="keyword">this</span>);
     newAct<span class="operator">-</span><span class="operator">&gt;</span>setShortcut(tr(<span class="string">"Ctrl+N"</span>));
     newAct<span class="operator">-</span><span class="operator">&gt;</span>setStatusTip(tr(<span class="string">"Create a new file"</span>));
     newAct<span class="operator">-</span><span class="operator">&gt;</span>setWhatsThis(tr(<span class="string">"Click this option to create a new file."</span>));
</pre>
<p>An alternative way to enter "What's This?" mode is to call
<a href="qwhatsthis.html#createAction">createAction</a>(), and add
the returned <a href="qaction.html">QAction</a> to either a menu or
a tool bar. By invoking this context help action (in the picture
below, the button with the arrow and question mark icon) the user
switches into "What's This?" mode. If they now click on a widget
the appropriate help text is shown. The mode is left when help is
given or when the user presses Esc.</p>
<p class="centerAlign"><img src="images/whatsthis.png" /></p>
<p>You can enter "What's This?" mode programmatically with <a href="qwhatsthis.html#enterWhatsThisMode">enterWhatsThisMode</a>(),
check the mode with <a href="qwhatsthis.html#inWhatsThisMode">inWhatsThisMode</a>(), and return
to normal mode with <a href="qwhatsthis.html#leaveWhatsThisMode">leaveWhatsThisMode</a>().</p>
<p>If you want to control the "What's This?" behavior of a widget
manually see <a href="qt.html#WidgetAttribute-enum">Qt.WA_CustomWhatsThis</a>.</p>
<p>It is also possible to show different help texts for different
regions of a widget, by using a <a href="qhelpevent.html">QHelpEvent</a> of type <a href="qevent.html#Type-enum">QEvent.WhatsThis</a>. Intercept the help
event in your widget's <a href="qwidget.html#event">QWidget.event</a>() function and call
<a href="qwhatsthis.html#showText">QWhatsThis.showText</a>() with
the text you want to display for the position specified in <a href="qhelpevent.html#pos">QHelpEvent.pos</a>(). If the text is rich
text and the user clicks on a link, the widget also receives a
<a href="qwhatsthisclickedevent.html">QWhatsThisClickedEvent</a>
with the link's reference as <a href="qwhatsthisclickedevent.html#href">QWhatsThisClickedEvent.href</a>().
If a <a href="qwhatsthisclickedevent.html">QWhatsThisClickedEvent</a> is handled
(i.e. <a href="qwidget.html#event">QWidget.event</a>() returns
true), the help window remains visible. Call <a href="qwhatsthis.html#hideText">QWhatsThis.hideText</a>() to hide it
explicitly.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QWhatsThis" />QWhatsThis.__init__ (<i>self</i>, <a href="qwhatsthis.html">QWhatsThis</a>)</h3><h3 class="fn"><a name="createAction" /><a href="qaction.html">QAction</a> QWhatsThis.createAction (<a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Returns a ready-made <a href="qaction.html">QAction</a>, used to
invoke "What's This?" context help, with the given
<i>parent</i>.</p>
<p>The returned <a href="qaction.html">QAction</a> provides a
convenient way to let users enter "What's This?" mode.</p>


<h3 class="fn"><a name="enterWhatsThisMode" />QWhatsThis.enterWhatsThisMode ()</h3><p>This function switches the user interface into "What's This?"
mode. The user interface can be switched back into normal mode by
the user (e.g. by them clicking or pressing Esc), or
programmatically by calling <a href="qwhatsthis.html#leaveWhatsThisMode">leaveWhatsThisMode</a>().</p>
<p>When entering "What's This?" mode, a <a href="qevent.html">QEvent</a> of type Qt.EnterWhatsThisMode is sent to
all toplevel widgets.</p>
<p><b>See also</b> <a href="qwhatsthis.html#inWhatsThisMode">inWhatsThisMode</a>() and
<a href="qwhatsthis.html#leaveWhatsThisMode">leaveWhatsThisMode</a>().</p>


<h3 class="fn"><a name="hideText" />QWhatsThis.hideText ()</h3><p>If a "What's This?" window is showing, this destroys it.</p>
<p><b>See also</b> <a href="qwhatsthis.html#showText">showText</a>().</p>


<h3 class="fn"><a name="inWhatsThisMode" />bool QWhatsThis.inWhatsThisMode ()</h3><p>Returns true if the user interface is in "What's This?" mode;
otherwise returns false.</p>
<p><b>See also</b> <a href="qwhatsthis.html#enterWhatsThisMode">enterWhatsThisMode</a>().</p>


<h3 class="fn"><a name="leaveWhatsThisMode" />QWhatsThis.leaveWhatsThisMode ()</h3><p>If the user interface is in "What's This?" mode, this function
switches back to normal mode; otherwise it does nothing.</p>
<p>When leaving "What's This?" mode, a <a href="qevent.html">QEvent</a> of type Qt.LeaveWhatsThisMode is sent to
all toplevel widgets.</p>
<p><b>See also</b> <a href="qwhatsthis.html#enterWhatsThisMode">enterWhatsThisMode</a>() and
<a href="qwhatsthis.html#inWhatsThisMode">inWhatsThisMode</a>().</p>


<h3 class="fn"><a name="showText" />QWhatsThis.showText (<a href="qpoint.html">QPoint</a>&#160;<i>pos</i>, QString&#160;<i>text</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>&#160;=&#160;None)</h3><p>Shows <i>text</i> as a "What's This?" window, at global position
<i>pos</i>. The optional widget argument, <i>w</i>, is used to
determine the appropriate screen on multi-head systems.</p>
<p><b>See also</b> <a href="qwhatsthis.html#hideText">hideText</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>